package com.pro.common.service.pay.model.mapstruct;

import com.pro.common.api.depencies.config.CommonMappingConfig;
import com.pro.common.api.model.request.pay.PaymentParamsDTO;
import com.pro.common.api.pay.model.db.PaymentOrder;
import com.pro.common.api.pay.model.db.PaymentChannel;
import com.pro.common.api.pay.model.db.PayMerchant;
import io.swagger.v3.oas.annotations.media.Schema;
import org.mapstruct.InheritConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.mapstruct.NullValuePropertyMappingStrategy;


@Schema(description = "支付单")
@Mapper(
        componentModel = "spring",
        config = CommonMappingConfig.class,
        nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE
)
public interface PaymentOrderMapper {

    @InheritConfiguration(name = "ignoreBaseFields")
    void updateFromParams(PaymentParamsDTO source, @MappingTarget PaymentOrder target);

    @InheritConfiguration(name = "ignoreBaseFields")
    void updateChannel(PaymentChannel source, @MappingTarget PaymentOrder target);

    @InheritConfiguration(name = "ignoreBaseFields")
    void updateMerchant(PayMerchant merchant, @MappingTarget PaymentOrder target);

}
